package com.znxz.hzqiuxm.ziniublog.user.gateways.controller;

import com.znxz.hzqiuxm.ziniublog.user.domain.dao.UserRepository;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Copyright © 2018年 ziniuxiaozhu. All rights reserved.
 *
 * @Author 临江仙 hzqiuxm@163.com
 * 无需权限验证的api
 * @Date 2018/9/2 14:21
 */
@Slf4j
@RestController
@RequestMapping("/todo")
public class TodoController extends BaseController{

    @Autowired
    private UserRepository userRepository;

    @GetMapping
    public String sayHello(){
        System.out.println("=========================");
        return "hello";
    }

    @GetMapping("/getWho")
    public String getUserNum(@RequestParam String userName) {
        String byUserName = userRepository.findByUserName(userName);

        System.out.println(byUserName);

        return byUserName;
    }

}
